package com.mySchool.service.Impl;

import com.github.pagehelper.*;
import com.mySchool.entity.*;
import com.mySchool.mapper.*;
import com.mySchool.service.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;

import java.util.*;

/**
* @author : Hinton
* @date : 2024/10/18 上午8:17
*/
@Service
public class LibraryServiceImpl implements LibraryService {
    @Autowired
    private LibraryMapper libraryMapper;

    @Autowired
    private BookMapper bookMapper;

    @Override
    public List<Library> findAll() {
        return libraryMapper.findAll();
    }

    @Override
    public Library findById(Long id) {
        return libraryMapper.findById(id);
    }

    @Override
    public List<Library> findByName(String name) {
        return libraryMapper.findByName(name);
    }

    @Override
    public List<Library> findDetail(String name) {
        return libraryMapper.findDetail(name);
    }

    @Override
    public List<Object> findBelow(String name, Integer pageNumber) {
        PageHelper.startPage(pageNumber, 100);
        List<Object> list = new ArrayList<>();
        List<Library> libraries = libraryMapper.findByName(name);
        for (Library library: libraries) {
            // list.addAll(bookMapper.findByLibrary(library.getLibraryId()));

        }
        return list;
    }
}
